import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;
import java.net.UnknownHostException;
import java.io.*;

public class Client {

	public void start() throws  Exception{
		Socket socket = new Socket("192.168.1.222",8000);
		//OutputStream out =socket.getOutputStream();
		writeMsg(socket);
		/*out.write("Hello".getBytes());
		out.flush();
		out.close();
		*/
	}

	public void writeMsg(Socket socket)throws Exception{
		BufferedReader br =new BufferedReader(new InputStreamReader(System.in) );		
		PrintWriter pw = new PrintWriter(new OutputStreamWriter(socket.getOutputStream( ),"utf-8"));
		String msg ;
		//String flag;
		while (null != (msg=br.readLine( )) ){
			System.out.println(msg);
			//String tmp =String();
			pw.println("皮皮虾:" +msg);
			pw.flush();
			//msg +=flag;
			//out.write(msg.getBytes());
			//out.flush();
			//bw.write(msg,0,msg.length());
			//bw.flush();
			
		}
	}

}
